package com.company;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try{
            Scanner sc = new Scanner(System.in);
            int m, n;
            String firstLine = sc.nextLine();
            String[] digits = firstLine.split(" ");
            m = Integer.parseInt(digits[0]);
            n = Integer.parseInt(digits[1]);
            int[][] roadGrid = new int[m][n];
            String[][] renderGrid = new String[2 * m + 1][2 * n + 1];
            for(int i = 0; i < 2 * m + 1; i++){
                for(int j = 0; j < 2 * n + 1; j++){
                    renderGrid[i][j] = "[W]";
                }
            }
            String secondLine = sc.nextLine();
            sc.close();
            String[] pairs = secondLine.split(";");
            for(int i = 0; i < pairs.length; i++){
                String[] pair = pairs[i].split(" ");
                if(pair.length < 2){
                    System.out.println("Incorrect command format.");
                    return;
                }
                Point[] points = new Point[2];
                for(int j = 0; j < pair.length; j++){
                    Point point = new Point();
                    String[] pointStr = pair[j].split(",");
                    point.x = Integer.parseInt(pointStr[0]);
                    if(!inRang(point.x, 0, m - 1)){
                        System.out.println("Number out of range.");
                        return;
                    }
                    point.y = Integer.parseInt(pointStr[1]);
                    if(!inRang(point.y, 0, n - 1)){
                        System.out.println("Number out of range.");
                        return;
                    }
                    points[j] = point;
                }
                if(points[0].x != points[1].x && points[0].y != points[1].y){
                    System.out.println("Maze format error.");
                    return;
                }
                if(points[0].x == points[1].x){
                    //
                    int x = 2 * points[0].x + 1;
                    int y1 = 2 * points[0].y + 1;
                    int y2 = 2 * points[1].y + 1;
                    for(int k = y1; k <= y2; k++){
                        renderGrid[x][k] = "[R]";
                    }
                }
                if(points[0].y == points[1].y){
                    //
                    int y = 2 * points[0].y + 1;
                    int x1 = 2 * points[0].x + 1;
                    int x2 = 2 * points[1].x + 1;
                    for(int k = x1; k <= x2; k++){
                        renderGrid[k][y] = "[R]";
                    }
                }
            }
            for(int i = 0; i < 2 * m + 1; i++){
                for(int j = 0; j < 2 * n + 1; j++){
                    System.out.print(renderGrid[i][j]);
                    if(j != 2 * n){
                        System.out.print("  ");
                    }
                }
                System.out.println();
            }
        }catch (Exception e){
            if(e instanceof NumberFormatException){
                System.out.println("Invalid number format.");
            }else if(e instanceof IndexOutOfBoundsException){
                System.out.println("Number out of range.");
            }
        }
    }

    static boolean inRang(int index, int min, int max){
        if(index<min || index > max){
            return false;
        }else{
            return true;
        }
    }

    static class Point{
        public int x;
        public int y;
    }
}
